package com.qf.job;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

@Component
public class MyJob implements SimpleJob {

    @Override
    public void execute(ShardingContext shardingContext) {
        //  任务是输出1111,2222,333
        //  将一个任务拆分成了三份
        switch (shardingContext.getShardingItem()){
            case 0:
                System.out.println("11111111111111");
                break;
            case 1:
                System.out.println("2222222222222222");
                break;
            case 2:
                System.out.println("333333333333333");
                break;
        }
    }
}
